import request from "../utils/request";

// 查找朋友
export function findPeopleService (data) {
  return request({
    url: "/chats/find_people",
    method: "post",
    data,
  });
}

// 加好友通知
export function insertFriendService (data) {
  return request({
    url: "/chats/insert/friends",
    method: "post",
    data,
  });
}

// 加为好友
export function beFriendService (data) {
  return request({
    url: "/chats/be_friend",
    method: "post",
    data,
  });
}

/**
 * 通过名称查找群
 * @param {*} data
 * @returns
 */
export function findGroupService (data) {
  return request({
    url: "/chats/group/findByName",
    method: "post",
    data,
  });
}

/**
 * 加群
 * @param {*} data
 * @returns
 */
export function joinGroupService (data) {
  return request({
    url: "/chats/group/join",
    method: "post",
    data,
  });
}

/**
 * 创建群
 * @param {*} data
 * @returns
 */
export function createGroupService (data) {
  return request({
    url: "/chats/group/create",
    method: "post",
    data,
  });
}

/**
 * 获取用户加入的群信息
 * @param {*} data
 * @returns
 */
export function getGroupService () {
  return request({
    url: "/chats/get/groups",
    method: "get",
  });
}

/**
 * 获取好友的信息
 * @param {*} data
 * @returns
 */
export function getFriendChatList (data) {
  return request({
    url: "/chats/friend/chatList",
    method: "post",
    data,
  });
}

/**
 * 清除好友的未读信息
 * @param {*} data
 * @returns
 */
export function readFriendMsg (data) {
  return request({
    url: "/chats/friend/read",
    method: "post",
    data,
  });
}

/**
 * 发送好友消息
 * @param {*} data
 * @returns
 */
export function saveFriendMsg (data) {
  return request({
    url: "/chats/private/saveMsg",
    method: "post",
    data,
  });
}
